package com.kobe.algorithm.niue.waterbottle;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * @author ：caopengfei
 * @date ：2021/5/6
 */
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        ArrayList<Integer> inputs = new ArrayList<>();
        while(true) {
            int input = scanner.nextInt();
            if (input <= 0  || input>100) {
                break;
            }
            inputs.add(input);
        }
        for (int input : inputs) {
            System.out.println(calculate(input));
        }
    }

    private static int calculate(int bottleCount){
        int count =0;
        while(bottleCount >=3){
            int temp =  bottleCount/3;
            int mod = bottleCount%3;
            count+=temp;
            bottleCount = temp+mod;
        }

        if(bottleCount ==2){
            count++;
        }
        return count;
    }

}
